*** Settings ***
Documentation  此测试模块会创建五个步骤，执行时需保证无此五个步骤名存在
Resource  ../流程层.robot
Suite Setup  进入步骤管理页
Suite Teardown  关闭浏览器
Force Tags  回归测试

*** Variables ***
&{getStep}  stepName=get步骤  address=http://10.10.122.54:8881/index  flag=SUCCESS
&{ccStep}  stepName=存储过程步骤  ccName=PTESTSLEEPEXCEPTION  param1=SLEEP_SECONDS  value1=0
...  param2=THROW_EXCEPTION_BOOLEAN  value2=N
&{shellStep}  stepName=shell步骤  shellPath=/home/lixiaolong/job  shellFile=startUp.sh  param=1  value=11
&{batStep}  stepName=bat步骤  batPath=D:\lee\script  batFile=test_task.bat  param=1  value=11
&{kettleStep}  stepName=kettle步骤  kettlePath=/home/lixiaolong/job  kettleFile=testParam_oracle.ktr
...  logPath=/home/lixiaolong/job/logs  param=param  value=11
&{postStep}  stepName=post步骤  address=http://10.10.122.54:8881/rex  flag=SUCCESS  doc=步骤编辑测试

*** Test Cases ***
同步HTTP步骤创建正例
    [Documentation]  get步骤无参数
    [Tags]  关键测试
    # 点击创建按钮
    点击元素  xpath=//*[@id="app"]/div/div[2]/div[1]/div/ul/li/button
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${getStep}[stepName]
    # 选择步骤类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[2]/div[1]/div[1]/ul/li[1]
    # 选择请求类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div[2]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[3]/div[1]/div[1]/ul/li[1]
    # 填写http地址
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[1]/div/div/div/input  ${getStep}[address]
    # 填写返回成功标志
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[2]/div/div/div/input  ${getStep}[flag]
    # 点击提交按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[1]
    # 获取提交结果并断言
    ${messeage}  获取文本  xpath=/html/body/div[4]/div/div[2]/div[1]/div[2]/p/p[2]
    should be equal  ${messeage}  处理成功
    # 点击确定按钮
    点击元素  xpath=/html/body/div[4]/div/div[3]/button

存储过程步骤创建正例
    [Documentation]  存储过程
    [Tags]  关键测试
    # 点击创建按钮
    点击元素  xpath=//*[@id="app"]/div/div[2]/div[1]/div/ul/li/button
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${ccStep}[stepName]
    # 选择步骤类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[3]/div[1]/div[1]/ul/li[2]
    # 输入存储过程名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[1]/div/div/div[1]/input   ${ccStep}[ccName]
    # 选择数据库
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[2]/div/div/div/div/div[1]/input
    点击元素  xpath=//span[contains(text(),'oracle27')]
    # 参数1
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div/div[1]/div[1]/div/div/div/input
    ...  ${ccStep}[param1]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div/div[1]/div[2]/div/div/div/input
    ...  ${ccStep}[value1]
    # 选择数据类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div/div[2]/div[1]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[5]/div[1]/div[1]/ul/li[2]
    # 添加一个参数
    点击元素  xpath=//i[@class='el-icon-plus']
    # 填写参数
    输入文本  xpath=/html[1]/body[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/form[1]/div[5]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/input[1]
    ...  ${ccStep}[param2]
    输入文本  xpath=//body//div[@class='el-card__body']//div//div[2]//div[1]//div[2]//div[1]//div[1]//div[1]//input[1]
    ...  ${ccStep}[value2]
    sleep  0.5
    点击元素  xpath=//body[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/form[1]/div[5]/div[2]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/input[1]
    点击元素  xpath=/html/body/div[6]/div[1]/div[1]/ul/li[2]/span
    # 点击提交按钮
    点击元素  xpath=//button[@class='el-button submit_btn el-button--default el-button--small']
    # 获取提交结果断言
    ${subMessage}  获取文本  xpath=/html/body/div[6]/div/div[2]/div[1]/div[2]/p/p[2]
    should be equal  ${subMessage}  处理成功
    # 点击确认按钮
    点击元素  xpath=/html[1]/body[1]/div[6]/div[1]/div[3]/button[1]

shell步骤创建正例
    [Documentation]  shell
    [Tags]  关键测试
    # 点击创建按钮
    点击元素  xpath=//*[@id="app"]/div/div[2]/div[1]/div/ul/li/button
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${shellStep}[stepName]
    # 选择步骤类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[3]/div[1]/div[1]/ul/li[3]
    # 选择节点地址
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[4]/div[1]/div[1]/ul/li
    # 填写shell信息
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div[1]/div/div/div/input
    ...  ${shellStep}[shellPath]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div[2]/div/div/div/input
    ...  ${shellStep}[shellFile]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[6]/div/div/div[1]/div/div/div/input
    ...  ${shellStep}[param]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[6]/div/div/div[2]/div/div/div/input
    ...  ${shellStep}[value]
    # 点击提交按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[1]
    # 获取提交结果断言
    ${text}  获取文本  xpath=/html/body/div[4]/div/div[2]/div[1]/div[2]/p/p[2]
    # 点击确认
    点击元素  xpath=/html/body/div[4]/div/div[3]/button

bat步骤创建正例
    [Documentation]  bat
    [Tags]  关键测试
    # 点击创建按钮
    点击元素  xpath=//*[@id="app"]/div/div[2]/div[1]/div/ul/li/button
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${batStep}[stepName]
    # 选择bat步骤类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div[1]/input
    点击元素  xpath=/html/body/div[3]/div[1]/div[1]/ul/li[4]
    # 选择节点地址
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[4]/div[1]/div[1]/ul/li
    # 填写bat信息
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div[1]/div/div/div[1]/input
    ...  ${batStep}[batPath]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div[2]/div/div/div[1]/input
    ...  ${batStep}[batFile]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[6]/div/div/div[1]/div/div/div/input
    ...  ${batStep}[param]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[6]/div/div/div[2]/div/div/div/input
    ...  ${batStep}[value]
    # 点击提交按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[1]
    # 获取提交结果断言
    ${text}  获取文本  xpath=/html/body/div[4]/div/div[2]/div[1]/div[2]/p/p[2]
    # 点击确认
    点击元素  xpath=/html/body/div[4]/div/div[3]/button

kettle步骤创建正例
    [Documentation]  kettle
    [Tags]  关键测试
    # 点击创建按钮
    点击元素  xpath=//*[@id="app"]/div/div[2]/div[1]/div/ul/li/button
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${kettleStep}[stepName]
    # 选择kettle步骤类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    点击元素  xpath=//span[text()='Kettle']
    # 选择节点地址
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[4]/div[1]/div[1]/ul/li
    # 填写kettle信息
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div[1]/div/div/div/input
    ...  ${kettleStep}[kettlePath]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[5]/div[2]/div/div/div/input
    ...  ${kettleStep}[kettleFile]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[6]/div[1]/div/div/div/input
    ...  ${kettleStep}[logPath]
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[6]/div[2]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[5]/div[1]/div[1]/ul/li[6]/span
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/div/div[1]/div/div/div/input
    ...  ${kettleStep}[param]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/div/div[2]/div/div/div/input
    ...  ${kettleStep}[value]
    # 点击提交按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[8]/div/button[1]
    # 获取提交结果断言
    ${text}  获取文本  xpath=/html/body/div[5]/div/div[2]/div[1]/div[2]/p/p[2]
    # 点击确认
    点击元素  xpath=/html/body/div[5]/div/div[3]/button

步骤创建清空按钮功能测试
    [Documentation]  填写步骤信息点击清空，然后创建一个post步骤
    点击元素  xpath=//*[@id="app"]/div/div[2]/div[1]/div/ul/li/button
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${postStep}[stepName]
    # 选择步骤类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[3]/div[1]/div[1]/ul/li[1]
    # 选择post请求类型
    sleep  0.5
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div[2]/div/div/div/div/div/input
    点击元素  xpath=/html/body/div[4]/div[1]/div[1]/ul/li[2]/span
    # 填写http地址
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[1]/div/div/div[1]/input  ${postStep}[address]
    # 填写返回成功标志
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[2]/div/div/div/input  ${postStep}[flag]
    # 点击清空按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[2]
    sleep  0.5
    # 验证清空是否生效
    ${nameValue}  获取值  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input
    ${typeValue}  获取值  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    ${requestValue}  获取值  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div[2]/div/div/div/div/div/input
    ${addValue}  获取值  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[1]/div/div/div[1]/input
    should be empty  ${nameValue}
    should be empty  ${typeValue}
    should be empty  ${requestValue}
    should be empty  ${addValue}
    # 重新输入内容提交
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[1]/div/div/div/input  ${postStep}[stepName]
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[2]/div/div/div/div/div/div/input
    sleep  0.5
    点击元素  xpath=/html/body/div[4]/div[1]/div[1]/ul/li[1]
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[3]/div[2]/div/div/div/div/div/input
    sleep  0.5
    点击元素  xpath=/html/body/div[4]/div[1]/div[1]/ul/li[2]/span
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[1]/div/div/div/input  ${postStep}[address]
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[4]/div[2]/div/div/div/input  ${postStep}[flag]
    # 点击提交按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[1]
    # 获取提交结果并断言
    ${messeage}  获取文本  xpath=/html/body/div[4]/div/div[2]/div[1]/div[2]/p/p[2]
    should be equal  ${messeage}  处理成功
    # 点击确定按钮
    点击元素  xpath=/html/body/div[4]/div/div[3]/button

步骤编辑流程测试
    [Documentation]  编辑页重置按钮校验，及步骤编辑流程校验
    # 输入步骤名称
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${postStep}[stepName]
    # 点击检索按钮
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[1]
    # 点击编辑按钮
    点击元素
    ...  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/table/tbody/tr/td[7]/div/div/span/button[1]
    # 输入描述
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[2]/div/div/div/input  ${postStep}[doc]
    # 重置按钮功能测试，点击重置按钮
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[2]
    sleep  0.5
    ${editText}  获取值  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[2]/div/div/div/input
    # 断言
    should be empty  ${editText}
    # 再次输入描述
    输入文本  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[1]/div[2]/div/div/div/input  ${postStep}[doc]
    # 提交
    点击元素  xpath=//*[@id="app"]/div/div/div[2]/div/div/form/div[7]/div/button[1]
    sleep  0.5
    # 提交结果断言
    ${message}  获取文本  xpath=/html/body/div[2]/div/div[2]/div[1]/div[2]/p/p[2]
    should be equal  ${message}  处理成功
    # 点击确定
    点击元素  xpath=/html/body/div[2]/div/div[3]/button
    # 检索到编辑后的步骤
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${postStep}[stepName]
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[1]
    # 获取步骤描述,判断反显结果
    ${stepDoc}  获取文本
    ...  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/table/tbody/tr/td[2]/div/div/span
    should be equal  ${stepDoc}  ${postStep}[doc]
    # 获取最近一条记录的编辑时间判断非空
    ${editTime}  获取文本
    ...  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/table/tbody/tr/td[6]/div/div/span
    should not be empty  ${editTime}

步骤删除流程测试
    # 筛选要删除的步骤
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${postStep}[stepName]
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[1]
    # 点击删除按钮
    点击元素
    ...  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/table/tbody/tr/td[7]/div/div/span/button[2]
    sleep  0.5
    # 删除提示文本校验
    ${delAlert}  获取文本  xpath=/html/body/div[2]/div/div[2]/div[1]/div/p/p[2]
    should be equal  ${delAlert}  确定删除？
    # 点击确定
    点击元素  xpath=/html/body/div[2]/div/div[3]/button[2]
    sleep  0.5
    # 点击确认
    点击元素  xpath=/html/body/div[2]/div/div[3]/button
    # 输入已删除步骤名称点击检索
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${postStep}[stepName]
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[1]
    # 判断删除结果
    ${text}  获取文本  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/div/span
    should be equal  ${text}  暂无数据

检索页清空按钮测试
    # 输入筛选条件
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${postStep}[stepName]
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[2]/div/div/span/div/input
    ...  ${postStep}[doc]
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[3]/div/div/div/div/div[1]/input
    sleep  0.5
    点击元素  xpath=/html/body/div[3]/div[1]/div[1]/ul/li[1]
    # 点击清空按钮
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[2]
    # 检验结果
    ${text1}  获取值  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ${text2}  获取值  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[2]/div/div/span/div/input
    ${text3}  获取值  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[3]/div/div/div/div/div[1]/input
    should be empty  ${text1}
    should be empty  ${text2}
    should be empty  ${text3}

删除取消按钮测试
    # 筛选要删除的步骤
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${getStep}[stepName]
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[1]
    # 点击删除按钮
    点击元素
    ...  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/table/tbody/tr/td[7]/div/div/span/button[2]
    sleep  0.5
    # 点击取消
    点击元素  xpath=/html/body/div[3]/div/div[3]/button[1]
    # 再次检索
    输入文本  xpath=//*[@id="app"]/div/div[1]/div/div[2]/div/form/div[1]/div[1]/div[1]/div/div/span/div/input
    ...  ${getStep}[stepName]
    点击元素  xpath=//*[@id="app"]/div/div[1]/div/div[2]/span/button[1]
    ${text}  获取文本
    ...  xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[1]/div[3]/table/tbody/tr/td[1]/div/div/span/span
    should be equal  ${text}  ${getStep}[stepName]
